const express = require('express')
const app = express()
const port = 5000

let bodyParser = require('body-parser')
app.use(bodyParser.json());  //配置解析，用于解析json和urlencoded格式的数据
app.use(bodyParser.urlencoded({ extended: false }));
// 静态资源处理
app.use(express.static('public'));


let cors = require('cors')
app.use(cors())              //配置跨域，必须在路由之前
// 导入路由
const router = require("./router")
app.use(router)

app.listen(port, () => {
    console.log(`http://localhost:${port}`);
})